home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr50 / pbc22b.zip / PBC$BAS.ZIP / MAVGD.BAS < prev    next >
BASIC Source File  |  1993-01-01  |  817b  |  25 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1993  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7. SUB MeanAverageD (Array#(), First%, Last%, Average#, ErrCode%)
  8.    ErrCode% = 0
  9.    IF First% = 0 THEN
  10.       F% = LBOUND(Array#, 1)
  11.    ELSE
  12.       F% = First%
  13.    END IF
  14.    IF Last% = 0 OR Last% < First% THEN
  15.       L% = UBOUND(Array#, 1)
  16.    ELSE
  17.       L% = Last%
  18.    END IF
  19.    FOR Tmp% = F% TO L%
  20.       Total# = Total# + Array#(Tmp%)
  21.       Count% = Count% + 1
  22.    NEXT
  23.    Average# = Total# / CDBL(Count%)
  24. END SUB
  25.